#pragma once

#ifndef ADAPTER_H_
#define ADAPTER_H_

#include <iostream>
#include <cstdlib>
#include <list>
using namespace std;


//////////////////////////////////////////////////////////////////////////
//the adapter pattern is to alter an interface so that it matches the 
//client that expecting
//here we just using the composition;
//
//////////////////////////////////////////////////////////////////////////

//interface Duck
class Duck
{
public:
	Duck() {}
	virtual ~Duck() {}
	virtual void Quack()=0;
	virtual void Fly()=0;
};

//interface turkey

class Turkey
{
public:
	Turkey() {}
	virtual ~Turkey() {}
	virtual void Gobble()=0;
	virtual void Fly()=0;
};

//instance of duck
class MallardDuck:public Duck
{
public:
	MallardDuck() {}
	~MallardDuck() {}

	void Quack()
	{
		cout<<"Quacking\n";
	}
	void Fly()
	{
		cout<<"Flying\n";
	}
};

class WildTurkey:public Turkey
{
public:
	WildTurkey() {}
	~WildTurkey() {}

	void Gobble()
	{
		cout<<"Gobbling\n";
	}
	void Fly()
	{
		cout<<"Flying a short distance\n";
	}
};

/*

*/
class TurkeyAdapter: public Duck
{
public:
	TurkeyAdapter(Turkey* tur):_turkey(tur)
	{

	}
	~TurkeyAdapter()
	{

	}

	void Quack()
	{
		_turkey->Gobble();
	}

	void Fly()
	{
		for(int i =0;i<5;++i)
			_turkey->Fly();
	}

private:
	Turkey*		_turkey;
};

#endif